package dynamic;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2023-05-12
 * Time: 14:14
 */

public class Client {
    public static void main(String[] args) {
        //目标对象
        ITeacherDao target = new TeacherDao();

        //给目标对象 创建代理对象
        ITeacherDao proxyInstance = (ITeacherDao) new ProxyFactory(target).getProxyInstance();

        //class com.sun.proxy.$Proxy0 内存中 动态生成了代理对象
        System.out.println(proxyInstance.getClass());

        //通过代理对象 调用目标对象的方法
        proxyInstance.teach();
    }
}
